// pages/enter/enter.js

//获取应用实例
const mdCode = require('../../utils/md5.js');
const desCode = require('../../utils/aesUtil.js');
const api_js = require("../../utils/api.js");
var app = getApp();

Page({

  /**
   * 页面的初始数据
   */
  data: {
    bar_Height: wx.getSystemInfoSync().statusBarHeight,

    imgSrc: '',
    videoSrc: '',
  },



  goIndex() {
    wx.navigateTo({
      url: `../../pages/index/index`
    })

  },



  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

    let wMsgID = desCode.wMsgID();
    // let wParam = desCode.to3des();
    let wParam = '';
    let md = mdCode.hexMD5('8888' + '100' + wMsgID + wParam + 'q1w2e3r4t5y6');
    const data = {
      wAgent: 8888,
      wAction: 100,
      wMsgID: wMsgID,
      wParam: wParam,
      wSign: md,
      wImei: 222,
      wVersion: 2,
      wRequestUserID: 4
    }
    api_js.postReq(data, (res) => {
      if (res.ReturnCode == 0){
        if(res.Data[0].categorykey == '1') {
          this.setData({
            imgSrc: res.Data[0].logo,
          })
        } else if (res.Data[0].categorykey == '2') {
          this.setData({
            videoSrc: res.Data[0].logo
          })
        }
      }
    });

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {


  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    return {
      title: '媛月幸福汇',
      path: '/pages/index/index?isShare=1',
      imageUrl: '/images/DefaultAvatar.png',
    }
  },
})